package com.zyy.study.always.code5;


import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;

public class Warehouse {
    private static final int capacity = 10;
    private LinkedBlockingQueue<String> queue = new LinkedBlockingQueue<>(capacity);
    public Map<String, Integer> producerMap = new HashMap<>();
    public Map<String, Integer> consumerMap = new HashMap<>();

    public void put(String ware) {
        try {
            queue.put(ware);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

    public String take() {
        try {
            String ware = queue.take();
            return ware;
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }

}

